﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChildUser.aspx.cs" Inherits="Yule8xWechat.Agent.ChildUser" %>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>推广记录</title>
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/comm.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/icon.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/my.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/agent.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Plugins/widget/iscroll/css/iscroll2.css" />
    <script src="../Skin/Theme/Js/flexible_css.js" type="text/javascript" charset="utf-8"></script>
    <script src="../Skin/Theme/Js/flexible.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
    <div class="content" id="content">
        <div id="scroller" class="scroller">
            <div id="pullDown" class="pulldown">
                <div class="pullDownLabel"></div>
            </div>
            <div class="dateresult">您当前累计推广<a class="datatext"><%=child_user_count %></a>人</div>

            <div class="toplist">
                <ul id="add">
                    <li class="datalist-title">
                        <div class="list-w30">时间</div>
                        <div class="list-w35">昵称</div>
                        <div class="list-w20">充值</div>
                        <div class="list-w15">代理</div>
                    </li>
                    <%
                        if (null != dtList)
                        {
                            string statusstr;
                            foreach (System.Data.DataRow r in dtList.Rows)
                            {
                                statusstr = r["is_agent"].ToString() == "0" ? "<div class='list-w15 t-success'>否</div>" : "<div class='list-w15 t-warn'>是</div>";
                                Response.Write(string.Format("<li class='datalist'><div class='list-w30'>{0}</div><div class='list-w35'>{1}</div><div class='list-w20'>{2}</div>{3}</li>", DateTime.Parse(r["regist_time"].ToString()).ToString("yyyy-MM-dd"), ShortText(r["nickname"],6), r["recharge_amount_total"], statusstr));
                            }
                        }
                    %>
                    <!--
                    <li class="datalist"><div class="list-w30">07-24 10:00</div><div class="list-w35">名字最长七个字</div><div class="list-w20">9999.00</div><div class="list-w15 t-warn">是</div></li>
                    <li class="datalist"><div class="list-w30">07-24 10:00</div><div class="list-w35">传说兔子没有毛</div><div class="list-w20">9999.00</div><div class="list-w15 t-success">否</div></li>
                    -->
                    <div id="pullUp" class="pullup">
                        <div class="pullUpLabel"></div>
                    </div>
                </ul>
            </div>
            <div id="hidediv"></div>
        </div>
    </div>
    <script src="../Skin/Theme/Js/jquery_2.1.3.js" type="text/javascript" charset="utf-8"></script>
    <script src="../Skin/Theme/Plugins/widget/iscroll/js/iscroll-probe.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            loaded();
            if (document.getElementById("add").getElementsByTagName("li").length < 16) {
                //$(".hidediv").height(window.screen.height);
                addblank();
            }
        })
        $("#warning-block").show();
        var myScroll;
        var pullDownEl, pullDownL;
        var pullUpEl, pullUpL;
        var Downcount = 0, Upcount = 0;
        var loadingStep = 0;//加载状态0默认，1显示加载状态，2执行加载数据，只有当为0时才能再次加载，这是防止过快拉动刷新

        function pullDownAction() {//下拉事件
            setTimeout(function () {
                location.reload();
            }, 100); //1秒
        }
        function pullUpAction() {//上拉事件
            setTimeout(function () {
                var el, li, i;
                el = $('#add');
                for (i = 0; i < 3; i++) {
                    li = $("");
                    Upcount++;
                    li.text();
                    //程序将新增数据加载到这
                    el.append(li);
                }
                pullUpEl.removeClass('loading');
                pullUpEl['class'] = pullUpEl.attr('class');
                pullUpEl.attr('class', '').hide();
                myScroll.refresh();
                loadingStep = 0;
            }, 100);
        }
        function addblank() {//上拉事件
            setTimeout(function () {
                var el, li, i;
                el = $('#hidediv');
                for (i = 0; i < 14; i++) {
                    li = $("<li class='addblank'></li>");
                    Upcount++;
                    li.text();
                    //程序将新增数据加载到这
                    el.append(li);
                }
                pullUpEl.attr('class', '').hide();
                myScroll.refresh();
                loadingStep = 0;
            }, 100);
        }
        function loaded() {
            pullDownEl = $('#pullDown');
            pullDownL = pullDownEl.find('.pullDownLabel');
            pullDownEl['class'] = pullDownEl.attr('class');
            pullDownEl.attr('class', '').hide();
            pullUpEl = $('#pullUp');
            pullUpL = pullUpEl.find('.pullUpLabel');
            pullUpEl['class'] = pullUpEl.attr('class');
            pullUpEl.attr('class', '').hide();
            myScroll = new IScroll('#content', {
                probeType: 2,//probeType：1对性能没有影响。在滚动事件被触发时，滚动轴是不是忙着做它的东西。probeType：2总执行滚动，除了势头，反弹过程中的事件。这类似于原生的onscroll事件。probeType：3发出的滚动事件与到的像素精度。注意，滚动被迫requestAnimationFrame（即：useTransition：假）。
                scrollbars: true,//有滚动条
                mouseWheel: true,//允许滑轮滚动
                fadeScrollbars: true,//滚动时显示滚动条，默认影藏，并且是淡出淡入效果
                bounce: true,//边界反弹
                interactiveScrollbars: true,//滚动条可以拖动
                shrinkScrollbars: 'scale',// 当滚动边界之外的滚动条是由少量的收缩。'clip' or 'scale'.
                click: true,// 允许点击事件
                keyBindings: true,//允许使用按键控制
                momentum: true// 允许有惯性滑动
            });
            //滚动时
            myScroll.on('scroll', function () {
                if (loadingStep == 0 && !pullDownEl.attr('class').match('flip|loading') && !pullUpEl.attr('class').match('flip|loading')) {
                    if (this.y > 5
) {
                        //下拉刷新效果
                        pullDownEl.attr('class', pullUpEl['class'])
                        pullDownEl.show();
                        myScroll.refresh();
                        pullDownEl.addClass('flip');
                        loadingStep = 1;
                    } else if (this.y < (this.maxScrollY - 5)
) {
                        //上拉刷新效果
                        pullUpEl.attr('class', pullUpEl['class'])
                        pullUpEl.show();
                        myScroll.refresh();
                        pullUpEl.addClass('flip');
                        loadingStep = 1;
                    }
                }
            });
            //滚动完毕
            myScroll.on('scrollEnd', function () {
                if (loadingStep == 1) {
                    if (pullUpEl.attr('class').match('flip|loading')) {
                        pullUpEl.removeClass('flip').addClass('loading');
                        loadingStep = 2;
                        pullUpAction();
                    } else if (pullDownEl.attr('class').match('flip|loading')) {
                        pullDownEl.removeClass('flip').addClass('loading');
                        loadingStep = 2;
                        pullDownAction();
                    }
                }
            });
        }
        document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
    </script>
</body>
</html>
